package com.test.daily.leetcode.y2022.m01.day0107;

import java.util.Stack;

/**
 * maxDepth
 *
 * @author Tom on 2022/1/7
 */
public class Code_MaxDepth {
    public int maxDepth(String s){
        char[] str = s.toCharArray();
        int max = 0;
        int size = 0;
        for(char ch: str){
            if(ch == '('){
                size++;
                max = Math.max(max, size);
            }else if(ch == ')'){
                size--;
            }
        }
        return max;
    }
}
